package com.ssy.lingxi.platform.manage.controller.feign;

import com.ssy.lingxi.common.controller.BaseController;
import com.ssy.lingxi.common.model.dto.MemberAndRoleIdDTO;
import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.platform.manage.api.model.dto.common.CommonIdListDTO;
import com.ssy.lingxi.platform.manage.api.model.dto.shop.SelfBusinessShopLogoDTO;
import com.ssy.lingxi.platform.manage.api.model.dto.shop.TemplateIdDTO;
import com.ssy.lingxi.platform.manage.api.model.vo.shop.SelfBusinessShopLogoVO;
import com.ssy.lingxi.platform.manage.api.model.vo.shop.ShopInnerVO;
import com.ssy.lingxi.platform.manage.api.model.vo.shop.ShopVO;
import com.ssy.lingxi.platform.manage.service.IShopService;
import com.ssy.lingxi.platform.manage.service.web.IShopWebService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 *  web - 商城
 * @author fhj
 * @version 2.0.0
 * @date 2021/09/26
 */
@RestController
@RequestMapping("/manage/shopWeb/feign")
public class ShopWebFeignController extends BaseController {

    @Resource
    private IShopService shopService;
    @Resource
    private IShopWebService shopWebService;

    /**
     * 获取自营商家的商城ID（内部接口）
     * @param dto 请求参数
     * @return 操作结果
     */
    @PostMapping("/findSelfBusinessShopId")
    public Wrapper<List<Long>> findSelfBusinessShopId(@RequestBody MemberAndRoleIdDTO dto) {
        return shopWebService.findSelfBusinessShopId(dto);
    }

    /**
     * 获取自营商家的商城LOGO（内部接口）
     * @param dto 请求参数
     * @return 操作结果
     */
    @PostMapping("/findSelfBusinessShopLogo")
    public Wrapper<List<SelfBusinessShopLogoVO>> findSelfBusinessShopLogo(@RequestBody SelfBusinessShopLogoDTO dto) {
        return shopWebService.findSelfBusinessShopLogo(dto);
    }

    /**
     * 根据商城ID集合获取商城(内部接口)
     * @param request 请求参数
     * @return 操作结果
     */
    @PostMapping("/byIds")
    public Wrapper<List<ShopInnerVO>> shopByIds(@RequestBody @Valid CommonIdListDTO request) {
        return shopService.shopByIds(request);
    }

    /**
     * 根据商城ID集合获取商城(新接口,内部接口)
     * @param request 请求参数
     * @return 操作结果
     */
    @PostMapping("/byShopIds")
    public Wrapper<List<ShopVO>> byShopIds(@RequestBody @Valid CommonIdListDTO request) {
        return shopService.byShopIds(request);
    }


}
